import service from "../../utils/request.ts";
import type {AxiosPromise} from "axios";
import type { VerifyCodeResult} from "./types.ts";


/**
 * 获取验证码
 * @returns {*}
 */
export  const  getCaptchaImage=(): AxiosPromise<VerifyCodeResult> =>{
    return   service({
        url: "/common/captchaImage",
        method: 'get',
        data: null
    })
}

/**
 * 下载文件接口
 * @returns {*}
 */
export  const  download=(fileName:string,header:object)=>{
  return  service({
       url: `/common/downloadFile`,
       method: 'get',
       params: {fileName},
       responseType: 'blob',
       headers: {
           'Accept': 'application/octet-stream', // 确保接收的是二进制数据
       },
       data: null
   })
}
/**
  * 获取验证码
 * @returns {*}
 */
export  const  GetRouters=() =>{
    return service({
        url: "/oauth/routers",
        method: 'get',
        data: null
    })
}

/**
 * 获取验证码
 * @returns {*}
 */
export  const  uploadAndPreview=(data) =>{
    return service({
        url: "/common/uploadAndPreview",
        method: 'post',
        data: data
    })
}